package user;

import operation.*;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-14
 * Time: 14:04
 */
public class NornmalUser  extends User{

    public NornmalUser(String name) {
        this.name = name;
        this.dooperation = new Operation[] {
                new ExitOperation(),
                new SearchOperation(),
                new LendOperation(),
                new ReturnOperation()
        };
    }

    @Override
    public int  menu() {
        System.out.println("========= 普通用户菜单 =========");
        System.out.println("1.查找书籍");
        System.out.println("2.借阅书籍");
        System.out.println("3.归还书籍");
        System.out.println("0.退出系统");
        System.out.println("请选择：");
        Scanner scan = new Scanner(System.in);
        while (true) {
            int choice = scan.nextInt();
            if(choice >=0 && choice<=4) {
                return choice;
            } else {
                System.out.println("输入错误，请重新输入");
            }
        }
    }
}
